package ipebg.mzk.provider.rabbitmq.producer.service.impl;

import ipebg.mzk.facade.rabbitmq.producer.service.IJiabanMQProducer;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("jiabanMQProducerImpl")
public class JiabanMQProducerImpl implements IJiabanMQProducer{
	private static Log log = LogFactory.getLog(JiabanMQProducerImpl.class);
	@Autowired
	private AmqpTemplate amqpTemplate;

	@Override
	public void sendDataToQueue(String queueKey, Object object) {
		try {
			amqpTemplate.convertAndSend(queueKey, object);
		} catch (Exception e) {
			log.error("sendDataToQueue error: queueKey is"+queueKey);
			throw e;
		}
	}

}
